<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03_JS数据类型</title>
</head>
<body>
<script>
    //数据类型:原始类型与引用类型
    //原始类型:number,string,boolean,null,undefined
    var a = 10;
    var b = 3.14;
    console.log(a, b,typeof a, typeof b);
    var c = "hello world";
    var d = 'hello world';
    console.log(c, d, typeof c, typeof d);
    var e = true;
    var f = false;
    console.log(e, f, typeof e, typeof f);
    var g = null;
    var h;//未定义为 undefined
    console.log(g, h, typeof g, typeof h);

    //引用类型:object
    var i = {}
    console.log(i, typeof i);
    i.name = "张三";
    i.age = 18;
    console.log(i);

    let obj = {
        name: "张三",
        age: 18
    }
    console.log(obj);
    obj.like = "吃吃吃";
    console.log(obj);

    //引用类型:数组
    let arr = [1, 2, 3, 4, 5];
    console.log(arr, typeof arr);
    console.log(arr[0], arr[1], arr[2], arr[3], arr[4]);
    console.log(arr[100]);

    //引用类型:Number()
    console.log(Number("123"));
    console.log(Number("123.456"));
    console.log(Number("0x10"));
    console.log(Number("hhh"));
    console.log(Number(true));

    //引用类型:Boolean()
    console.log(Boolean(false));// false
    console.log(Boolean(0));//  false
    console.log(Boolean(""));// false
    console.log(Boolean(" ")); // true
    console.log(Boolean(null));// false
    console.log(Boolean(undefined));// false
    console.log(Boolean(NaN));// false
    console.log(Boolean(1));// true
    console.log(Boolean("hello"));// true
    console.log(Boolean(-1));// true



</script>
</body>
</html>































